package cn.xtcode.domain.trade.adapter.repository;

import cn.xtcode.domain.trade.model.aggregate.GroupBuyOrderAggregate;
import cn.xtcode.domain.trade.model.aggregate.GroupBuyTeamSettlementAggregate;
import cn.xtcode.domain.trade.model.entity.GroupBuyActivityEntity;
import cn.xtcode.domain.trade.model.entity.GroupBuyTeamEntity;
import cn.xtcode.domain.trade.model.entity.MarketPayOrderEntity;
import cn.xtcode.domain.trade.model.entity.NotifyTaskEntity;
import cn.xtcode.domain.trade.model.valobj.GroupBuyProgressVO;

import java.util.List;

/**
 * @Author xt-code
 * @Description:
 * @Create 2025/5/9 18:47
 */
public interface ITradeRepository {
    MarketPayOrderEntity queryNoPayMarketPayOrderByOutTradeNo(String userId, String outTradeNo);

    GroupBuyProgressVO queryGroupBuyProgress(String teamId);

    MarketPayOrderEntity lockMarketPayOrder(GroupBuyOrderAggregate groupBuyOrderAggregate);

    /**
     * 查询当前活动信息
     *
     * @param activityId
     * @return
     */
    GroupBuyActivityEntity queryGroupBuyActivityByActivityId(Long activityId);

    /**
     * 查询用户是否参与某项活动
     */
    Integer queryOrderCountByActivityId(Long activityId, String userId);

    MarketPayOrderEntity queryMarketPayOrderEntityByOutTradeNoAndUserId(String userId, String outTradeNo);

    GroupBuyTeamEntity queryGroupBuyTeamByTeamId(String teamId);

    boolean settlementMarketPayOrder(GroupBuyTeamSettlementAggregate groupBuyTeamSettlementAggregate);

    boolean isSCBlackIntercept(String source, String channel);

    List<NotifyTaskEntity> queryUnExecutedNotifyTaskList();

    List<NotifyTaskEntity> queryUnExecutedNotifyTaskList(String teamId);

    int updateNotifyTaskStatusSuccess(String teamId);

    int updateNotifyTaskStatusError(String teamId);

    int updateNotifyTaskStatusRetry(String teamId);
}
